The unique features of FindGraph are exposed through Automation (formerly called OLE Automation).
Through the methods and properties that are exposed, client applications written
in Microsoft Visual Basic« or Microsoft Visual C++« can be used
to control fitting features of FindGraph.
Properties:
VARIANT ArrayVar
Array of dimension 3N with points (X, Y, Z)
as VARIANT SAFEARRAY.
- Input - Fill this array with data points (X, Y).
- Output- FindGraph fills column Z with calculated values.
long ApprParamsNumber
Number of parameters M
- Output - FindGraph fills this with the number of parameters.
VARIANT ArrayParams
Array of dimension M
String FuncApprString
String
- Input - Use this string to send user DLL name.
- Output- FindGraph fills this string with information about fitting model.
long Weighting
Number
- Input - Use this value to set weighting schema.
0 No weight, Wi = 1
1 Statistical, Wi = 1/Yi
2 Statistical, Wi = Yi
3 Statistical, Wi = 1/Xi
4 Statistical, Wi = Xi
5 Instrumental, Wi = 1/Zi^2
6 Direct, Wi = Zi
Methods
long FuncApprStart(short nFunctionId)
This prepares the buffer.
long FuncApprEnd()
You have to call this to free memory
long FuncApprCreate(short nColor, short nWidth, BSTR lpctstrName)
Creates new curve fit.
- nColor - Number of color one of 6 possible:
0 BLACK
1 BLUE
2 GREEN
3 RED
4 BROWN
5 GRAY
- nWidthDot - width of line, 0.1 mm;
- lpctstrName - curve fit title;
- return the unique identifier of a curve fit functiondwId if success else -1
double FuncApprInPoint(long dwId, double x)
Calculates value of function in point x.
- dwId - the unique identifier of a curve fit function returned by FuncApprCreate;
- x - X value;
- return Y value calculated.
double GetApprPara(short num)
Returns value of parameter.
Sample
To fit your data, follow these steps:
- FuncApprStart(nIdFunc)
nFunctionId- fitting model identifier.
- Use variant array vaPoints.
Fill array va[3N] of dimension 3N with data points (X, Y, Z).
vaPoints = FindGraph.ArrayVar
- Use variant array vaParams.
Fill array va[M] of dimension M with parameters.
vaParams = FindGraph.ArrayParams
- Fit data and create new curve.
dwFunc = FuncApprCreate(nColor, nWidth, Name)
- Free memory
FindGraph.FuncApprEnd();
- Calculate value of function in point x.
FuncApprInPoint(dwId, x)
By using Automation, the following sample, written in Visual Basic, demonstrates how to fit your data.
See project and testApprVB.exe in directory testApprVB.
This runs program FindGraph in new window.
Fitting model identifiers
| Regression: |
0 | Polynomial f(U) = a0 + a1*U + a2*U^2 + ... |
2 | Hyperbolic f(U) = a0 + a1/U + a2/U^2 + ... |
4 | Logarithmic f(U) = a0 + a1*ln(U) + a1*ln(U)^2 + ... |
6 | Power ln(f) = a0 + a1*ln(U) + a1*ln(U)^2 + ... |
8 | Exponential ln(f) = a0 + a1*U + a2*U^2 + ... |
|
|
10 | Linear Regression |
|
|
20 | Piece linear |
32 | B Spline curve |
38 | Parametric curve |
50 | Logistic model |
51 | Gompertz model |
60 | Fourier approximation |
70 | Neural network rational sigmoid |
71 | Neural network exp sigmoid |
80 | User defined function |
88 | Non-linear least-square fitting (predefined function) |
90 | Non-linear least-square fitting (your Formula) |
See Fitting Models for details.
Parameters
In all models:
vaParams(0) | 0 - y=f(x), 1 - x=f(y) |
Regression (Polynomial, Hyperbolic, Logarithmic, Power, Exponential):
vaParams(1) | Order for regression line or 0 |
Linear Regression:
vaParams(1) | Must be 1 |
vaParams(2...11) | Polynomial, V(U) = V0 + a11*(U-U1)/W1+
a12*((U-U1)/W1)^2 + ..., |
| vaParams(2) = U1, vaParams(3) = W1, vaParams(3+i) = 1,
if use a1i |
vaParams(12...21) | Rational, V(U) =... + a21*W2/(U-U2) + a22*(W2/(U-U2))^2
+ ..., |
| vaParams(12) = U1, vaParams(13) = W1,
vaParams(13+i) = 1, if use a2i |
vaParams(22...31) | V(U) =... + a31*sqrt(W2/(U-U2)) +
a32*sqrt(((U-U2)/W2)) + ... |
| vaParams(22) = U1, vaParams(23) = W1,
vaParams(23+i) = 1, if use a3i |
vaParams(32...41) | Logarithmic, V(U) =... + a41*ln (U-U4)/W4 + a42* (ln((U-U4)/W4)^2 + ... |
| vaParams(32) = U1, vaParams(33) = W1,
vaParams(33+i) = 1, if use a4i |
vaParams(42...51) | Exponential, V(U) =... + a51*exp(U-U5)/W5 + a52* exp(2*(U-U5)/W5) + ... |
| vaParams(42) = U1, vaParams(43) = W1,
vaParams(43+i) = 1, if use a5i |
vaParams(52...61) | Fourier, V(U) =... + a61*sin(U-U6)/W6 + a62* sin(2*(U-U6)/W6) + ... |
| vaParams(52) = U1, vaParams(53) = W1,
vaParams(53+i) = 1, if use a6i |
vaParams(62...71) | Polynomial, V(U) = V0 + a11*(U-U1)/W1 + ..., |
| V(U) =... + a71*cos(U-U6)/W6 + a72* cos(2*(U-U7)/W6) + ... |
| See Linear Regression for details. |
| |
Piece linear:
vaParams(1) | Number of steps |
vaParams(2...11) | Polynomial |
Fourier approximation:
vaParams(1) | Number of harmonics |
Neural network approximations:
vaParams(1) | Number of neurons |
vaParams(2) | Parameter A |
vaParams(3) | Step |
vaParams(4) | Maximum number of iterations |
User defined function:
vaParams(1) | Unused, must be 1 |
vaParams(2) | Parameter 1 |
vaParams(3) | Parameter 2 |
vaParams(4) | Parameter 3 |
vaParams(5) | Parameter 4 |
FuncApprString | DLL name in directory "APPR", "POLI_N.DLL" for example |
B-Spline curve:
vaParams(1) | Unused, must be 1 |
vaParams(2) | Unused, must be 0 |
vaParams(3) | 0 - Least squares approximation, 1 - Interpolation |
vaParams(4) | If 1 - closed curve |
vaParams(5) | Number of control points: 1-12 |
vaParams(6) | Degree: 1-6 |
Parametric curve:
vaParams(1) | Unused, must be 1 |
vaParams(2) | Center point X value, if 'Fixed center' |
vaParams(3) | Center point X value |
vaParams(4) | If 1 - 'Fixed center' is used |
vaParams(5) | Number of sin(u), cos(u) harmonics: 1-6 |
vaParams(6) | Number of base points: 8-256 |
Non-linear Fitting:
vaParams(1) | Unused, must be 1 |
vaParams(2) | Fitting curve Equation,
parabola + sqrt for example |
vaParams(3) | Fitting Model, polynomial for example |
vaParams(4) | Step |
vaParams(5) | Number of Iterations |
vaParams(6) | Model, 0 - Simplex, 1 - Gradient |
vaParams(7) | If > 0 - Normalize X |
vaParams(8) | Initial value of parameter A |
vaParams(9) | Initial value of parameter B |
vaParams(10) | Initial value of parameter C |
vaParams(11) | Initial value of parameter D |
vaParams(12) | Initial value of parameter G |
vaParams(13) | If > 0 - Fixed parameter A |
vaParams(14) | If > 0 - Fixed parameter B |
vaParams(15) | If > 0 - Fixed parameter C |
vaParams(16) | If > 0 - Fixed parameter D |
Formula:
All parameters as for Non-linear Fitting.
FuncApprString | Formula, "a + b*u + c*u*u +
d*sin( u )" for example |
See Fitting Parameters for details.
Nonlinear Fitting Models
1000 | Polynomial |
2000 | Exponential |
3000 | Logarithm |
4000 | Power |
5000 | Hyperbola |
6000 | Rational |
7000 | Sigmoidal |
8000 | Peak |
9000 | Waveform |
10000 | Asymptotic |
Nonlinear Fitting Equations
Polynomial
1010 | Const |
1020 | Straight Line |
1030 | Parabola |
1040 | Polynomial4 |
1050 | Polynomial5 |
1060 | ParabolaSqrt |
1070 | PolynomialSqrt 3 |
1080 | PolynomialSqrt 4 |
Exponential
2010 | Exponential 1 |
2020 | Exponential 2-1 |
2030 | Exponential 2-2 |
2040 | Exponential 2-3 |
2050 | Exponential 2-4 |
2060 | Exponential3 |
2070 | Stirling |
2100 | Exp Decay 4 |
2110 | Exp Decay 5 |
2120 | Exp2 Decay 5 |
2200 | Exp Growth 3 |
2210 | Exp Growth 4 |
2220 | Exp2 Growth 5-1 |
2230 | Exp2 Growth 5-2 |
2300 | Modified Exponential 2 |
2310 | Modified Exponential 3 |
2320 | Exp and Linear |
2330 | Shah |
2340 | Yeild-fertilizer |
2350 | Vapor Pressure Model |
2360 | Exp Gauss |
Logarithm
3010 | Logarithm 1 |
3020 | Logarithm 2-1 |
3030 | Logarithm 2-2 |
3040 | Logarithm 3 |
3050 | Bradley |
Power
4010 | Power Fit |
4020 | Allometric |
4030 | Shifted Power 2 |
4040 | Shifted Power 3 |
4050 | Shifted Power 4 |
4060 | Gamma |
4070 | Geometric |
4080 | Modified Geometric |
4100 | Root Fit |
4110 | Hoerl |
4120 | Freundlich |
4130 | Gunary |
4140 | Langmuir |
4150 | Pareto |
Hyperbola
5010 | Saturation Growth |
5020 | Double Hyperbola |
5030 | Generalized Hyperbola |
5040 | Bent Hyperbola |
5050 | Heat-Capacity Model |
5060 | Inverse |
Rational
6010 | Rational 2 |
6020 | Rational 3 |
6030 | Rational 4 |
6040 | Nelder |
6050 | BET |
Sigmoidal
7010 | Gompertz Model |
7020 | Logistic Model |
7030 | Richards Model |
7040 | Boltzmann |
7050 | Weibull |
7060 | MMF Model |
7070 | Hill |
7080 | Logistic 4 |
Peak
8010 | Beta Distribution |
8020 | Extreme |
8030 | Gaussian |
8040 | Log Normal |
8050 | Logistic Peak |
8060 | Lorentz Equation |
8070 | Lorentz Peak |
8080 | Bell |
8090 | Pulse |
Waveform
9010 | Sinusoidal Fit |
9020 | Sine |
9030 | Sine Damp |
9040 | Sine Sqr |
9050 | Truncated Fourier |
Asymptotic
10010 | Asymptotic 1 |
10020 | Asymptotic 2-1 |
10030 | Asymptotic 2-2 |
10040 | Asymptotic 3-1 |
10050 | Asymptotic 3-2 |
10060 | Monomolecular 3-1 |
10070 | Monomolecular 3-2 |
10080 | Box Lucas 2-1 |
10090 | Box Lucas 2-2 |
10100 | Chapman |
10110 | Power Asymptotic 2-1 |
10120 | Power Asymptotic 2-2 |
10200 | Reciprocal Model |
10210 | Reciprocal Quadratic |
10220 | Reciprocal Logarithm |
10230 | Bleasdale-Nelder3 |
10240 | Bleasdale-Nelder4 |
10250 | Harris |
See documentation on methods and properties.
á